package com.dzx.design.behavioral.state;

/**
 * @author dzx
 * @ClassName:
 * @Description:
 * @date 2019年08月15日 11:31:28
 */
public class Test {
    public static void main(String[] args) {
        CourseVideoContext courseVideoContext = new CourseVideoContext();
        //设置初始状态为播放状态，并将上下文设置到自身的状态中
        courseVideoContext.setCourseVideoState(new PlayState());

        System.out.println("当前状态：" + courseVideoContext.getCourseVideoState().getClass().getSimpleName());

        courseVideoContext.pause();
        System.out.println("当前状态：" + courseVideoContext.getCourseVideoState().getClass().getSimpleName());

        courseVideoContext.speed();
        System.out.println("当前状态：" + courseVideoContext.getCourseVideoState().getClass().getSimpleName());

        courseVideoContext.stop();
        System.out.println("当前状态："+courseVideoContext.getCourseVideoState().getClass().getSimpleName());

        //停止状态下不能直接暂停
        courseVideoContext.pause();
    }
}
